/*
 * Occurrence.cpp
 *
 *  Created on: Mar 5, 2011
 *      Author: Craig Wilson
 */

#include "../inc/Occurrence.h"

		ostream &operator<<(ostream &stream, Occurrence *o){
  			stream << o->getSite() << ":" <<o->getCount();
  			return stream;
		}

            Occurrence::Occurrence(Page &address){
            	site=&address;
            	count=0;
            }

            Occurrence::Occurrence(const Occurrence &other){
            	site=other.site;
            	count=other.count;
            }


            Occurrence& Occurrence::operator =(const Occurrence &other){
            	if (this!=&other){
            		site=other.site;
            		count=other.count;
            	}
            	return *this;
            }


            Occurrence::~Occurrence(){
            	//do not delete Page!!!!
            }

            int Occurrence::increment(){
            	return ++count;
            }
            Page* Occurrence::getSite(){
            	return site;
            }
            int Occurrence::getCount(){
            	return count;
            }

            int Occurrence::compare(Occurrence &other){
            	return site->compare(*(other.site));
            }

